import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Enumeration;

@WebServlet("/servlet")
public class MyServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
         resp.setContentType("text/html; charset=utf8") ;
         StringBuilder builder = new StringBuilder() ;
         builder.append(req.getProtocol());
         builder.append("<br>") ;
         builder.append(req.getMethod()) ;
         builder.append("<br>") ;
         builder.append(req.getContextPath());
         Enumeration<String>  enumeration=  req.getParameterNames();
          while (enumeration.hasMoreElements()){
              String str = enumeration.nextElement();
              builder.append(str+" = "+req.getParameter(str));
              builder.append("<br>") ;
          }
          builder.append(req.getContentType()) ;
          resp.getWriter().write(builder.toString());

    }
}
